# *-*- coding:utf-8 -*-
# @Author  : Eliza
# @Time    : 2021/7/18 1:09
# @Software : RubyMine
# [0--4,5]
array = [1, 2, 3, "A", true]
puts "---------------"
array.each_index do |index|
  puts index
end
puts "---------------"
for value in array do
  puts value
end
puts "---------------"
# [0--3]
for index in 0..array.length-2 do
  puts index
end

puts "-----while sum>=0----------"
sum=array.length
while sum>=0
  puts sum
  sum-=1
end
puts "---------------"
until sum>=5
  sum+=1
  puts sum
end